<?php
class UserSettingsObjModel extends Model {

	public function getUserSettings($id) {
		$query = sprintf("
			SELECT
				*
			FROM
				`user_settings`
			WHERE
				`user_settings`.`id_user` = %d;
		", $id);
		return $this->_sqlInstance->query($query);
	}

	public function update(UserSettings $settings) {
		$query = sprintf("
			UPDATE
				`user_settings` `us`
			SET
				`us`.`language` = '%s',
				`us`.`leks_per_page` = %d,
				`us`.`prefer_dictionary` = %d
			WHERE
				`id_user` = %d
		", $settings->getLanguage(), $settings->getLeksPerPage(), $settings->getPreferDict(), $settings->getId());
		return $this->_sqlInstance->query($query);
	}
}